class PSPauseMenuGFX extends GFxMoviePlayer;

var GFxObject mc, tutLang, subtLang;
//var int idioma;

function bool Start(optional bool StartPaused = false)
{
    super.Start();
    Advance(0);

	mc = GetVariableObject("_root");
	
	//tutLang = GetVariableObject("testButton");
	//subtLang = mc.Get("_root.clipSubtiulos");
	//tutLang = GetVariableObject("_level0.clipTutorial");
	//subtLang = GetVariableObject("_level0.clipSubtiulos");

	//idioma = PSGameInfo(GetPC().WorldInfo.Game).subtitleLang;
	//SetVariableNumber("_root.subtitulos",idioma);
	//num = GetVariableNumber("_root.subtitulos");
	//idioma = idioma*10;
	//subt.GotoAndStopI(idioma);

	//idioma = PSGameInfo(GetPC().WorldInfo.Game).tutorialLang;
	//SetVariableNumber("_root.tutial",idioma);
	//idioma = idioma*10;
	//tut.GotoAndStopI(idioma);


	mc.GotoAndPlay("pauseScreen");

	GetPC().MyHUD.PlayerOwner.SetPause(true);
	
	//AddCaptureKey('XboxTypeS_Start');
	//AddCaptureKey('Escape');


	return true;
}


event bool WidgetInitialized(name WidgetName, name WidgetPath, GFxObject Widget)
{
	switch(WidgetName)
	{
		case ('txtSubtLang'):
			subtLang = Widget;
			subtLang.SetText(getTextoIdioma(PSGameInfo(GetPC().WorldInfo.Game).subtitleLang));
			break;

		case ('txtTuttLang'):
			tutLang = Widget;
			tutLang.SetText(getTextoIdioma(PSGameInfo(GetPC().WorldInfo.Game).tutorialLang));
			break;

	}

	return true;
}


function ChangeTutorialLanguage()
{
	local int idioma;
	idioma = PSGameInfo(GetPC().WorldInfo.Game).tutorialLang;

	if(idioma==1)       idioma = 2;
	else if(idioma==2)  idioma = 0;
	else                idioma = 1;

	PSGameInfo(GetPC().WorldInfo.Game).tutorialLang = idioma;
	PSGameInfo(GetPC().WorldInfo.Game).SaveConfig();

	tutLang.SetText(getTextoIdioma(idioma));
}

function ChangeSubtitlesLanguage()
{
	local int idioma;
	idioma = PSGameInfo(GetPC().WorldInfo.Game).subtitleLang;

	if(idioma==1)       idioma = 2;
	else if(idioma==2)  idioma = 0;
	else                idioma = 1;

	PSGameInfo(GetPC().WorldInfo.Game).subtitleLang = idioma;
	PSGameInfo(GetPC().WorldInfo.Game).SaveConfig();

	subtLang.SetText(getTextoIdioma(idioma));
}



function string getTextoIdioma(int idioma)
{
	local string resutl;
	resutl = "NO";

	if(idioma==1)       resutl = "SPANISH";
	else if(idioma==2)  resutl = "ENGLISH";
	else                resutl = "NO";

	return resutl;
}

function OnCmdRestartClick()
{
	GetPC().MyHUD.PlayerOwner.SetPause(false);
	self.Close(true);
}

function OnCmdMainMenuClick()
{
	ConsoleCommand("open MainMenu");
}

function GotoControlsScreen()
{
	mc.GotoAndStop("controlsScreen");
}

function GotoCreditsScreen()
{
	mc.GotoAndStop("creditsScreen");
}



// subtitulos
function SetSubtitlesNo()
{
	PSGameInfo(GetPC().WorldInfo.Game).subtitleLang = 0;
}

function SetSubtitlesES()
{
	PSGameInfo(GetPC().WorldInfo.Game).subtitleLang = 1;
}

function SetSubtitlesEN()
{
	PSGameInfo(GetPC().WorldInfo.Game).subtitleLang = 2;
}


// Tutorial
function SetTutorialNo()
{
	PSGameInfo(GetPC().WorldInfo.Game).tutorialLang = 0;
}

function SetTutorialES()
{
	PSGameInfo(GetPC().WorldInfo.Game).tutorialLang = 1;
}

function SetTutorialEN()
{
	PSGameInfo(GetPC().WorldInfo.Game).tutorialLang = 2;
}



DefaultProperties
{
	bEnableGammaCorrection=false
	bPauseGameWhileActive=false
	bCaptureInput=true
	bCaptureMouseInput=true
	bAllowFocus=true
	MovieInfo = SwfMovie'PS_menus.PSGame_menu'
}
